#include <cstdio>

struct ClockOfTheLongNow {
  ClockOfTheLongNow() { year = 2019; }
  ClockOfTheLongNow(int year_in) {
    if (!set_year(year_in)) {
      year = 2019;
    }
  }
  void add_year() { year++; }
  bool set_year(int new_year) {
    if (new_year < 2019) {
      return false;
    } else {
      year = new_year;
      return true;
    }
  }
  int get_year() const { return year; }

private:
  int year;
};

// 参数是引用类型的
void add_year(ClockOfTheLongNow &clock) { clock.add_year(); }

int main(int argc, char **argv) {
  ClockOfTheLongNow clock;
  printf("The year is %d\n", clock.get_year());
  // clock implicitly passed by reference
  add_year(clock);
  printf("The year is %d\n", clock.get_year());
  return 0;
}
